import java.util.Arrays;

public class Text2 {
    public static void main(String[] args) {
       int[] arr ={1,2,3,4,5};
       fun(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static void fun(int[] arr){
        int front = 0;
        int rear = arr.length-1;
        while( front < rear && arr[front] % 2 == 1){
            front++;
        }
        while( front < rear && arr[rear] % 2 == 0){
            rear--;
        }
        if(front<rear){
            int tmp= arr[front];
            arr[front] =arr[rear];
            arr[rear] = tmp;
        }
    }
}
